I'm not sure where this post goes, but added it as an issue for video upload so it'd be associated with the module.
Problem (as I saw it): Lightbox seemed to only work with emfield video. However, emfield didn't let the user "upload a video to your site" and actually be sent to youtube. This is fine if you want someone to post a video already hosted from youtube. However, if you wanted them to "upload a video to your site", it wasn't allowing for the lightbox implementation.
I've made a couple small changes that allow someone to upload a video via video_upload, and actually be shown via lightbox.
Step 1:
Find the function lightbox2_video_cck inside lightbox2.module.
Step 2:
Add the following immediately inside the foreach ($items as $item) { loop:
if(isset($item['id']) && !isset($item['value']))
$item['value'] = $item['id'];
if(isset($item['id']) && !isset($item['provider']))
$item['provider'] = 'youtube';
Step 3:
Find the video_upload_field_formatter_info function inside video_upload.module
Step 4:
Add lightbox2 option to formater array. This is done by placing the following code immediately inside return array( array:
'lightbox2' => array(
'label' => t('Lightbox2'),
'field types' => array('video_upload'),
),
Step 5:
Find the function video_upload_field_formatter, also inside video_upload.module.
Step 6:
Add code to do the lightbox if this is selected as an option. The case statement in this function handles this. Find the case statement, and add the following:
case 'lightbox2':
$item['value'] = $item['id'];
$item['provider'] = 'youtube';
$field['widget']['video_width'] = 425;
$field['widget']['video_height'] = 350;
$output .= theme('lightbox2_video_cck', $field, $item, $formatter, $node);
return $output;
Step 7:
Go to administer->content management->content types->whatever your content type is->display fields. Select lightbox as the option for either teaser or default. It'll now show a thumbnail instead of the video player. If the user clicks the thumbnail, the video shows up in a lightbox.
Caveats:
If you want to add this to an existing video_upload field, you won't immediately see 'lightbox' as an option under display fields. I'm assuming this is because drupal doesn't ask for the formatters each time.
You can get around this by adding a token new video_upload_field to the content type. This'll cause a warning about an illegal argument to the foreach on line 938 (or so) when you click manage fields. I don't know why this happens. Anyways, simply go to display fields, select which video_upload_field you want to show up in lightbox. Then, remove the token video_upload_field that was added. You should no longer see the warning when you click on manage fields.
I hope this helps someone. I'm just trying to give back to the drupal community by lending a little (limited) expertise.
Comments
Comment #1
ccdoss commentedOops...another caveat:
You can change the size of the video by changing the values in the
settings.
Comment #2
plan9 commentedI'm trying to find a way to enable full screen playback - the button is missing from the default player interface. Will Lightbox enable full screen playback of youtube video?
Thanks for any info
Comment #3
ccdoss commentedI believe that's something that must be passed in url that's sent to youtube. You can probably find this information in the youtube api. It may also be something that can be passed to the flash player.
If you find a way to pass it in the youtube parameters, the url string is put together in youtube.inc under the emfield directory. You may find a way to add some options in function theme_video_cck_youtube_flash there.
If you find a way to do it on the flash player, lightbox2 allows adding parameters on the settings page.
I hope this helps.
Comment #4
plan9 commentedThanks for your suggestions. It look's like the 6.x branch of video_upload does have a full screen toggle button. Maybe there's a straightforward way to backport this quite essential feature. I've posted a request. Sadly not all of us are unble to upgrade to Drupal 6 yet.